import game
import floor
import dialog

class Mainloop:
    @staticmethod
    def gameover():
        game.Game.I.status["where"] = "gameover"

    @classmethod
    def mainloop(mp:"Mainloop",cm:dialog.ChoiceManager):
        status = mp.status = game.Game.I.status
        g = status["activeGame"] = {}
        mp.currentFloor = g["currentFloor"] = {}
        g["currentFloor"]["floor"] = floor.Floor()
        g["currentFloor"]["Id"] = 0

        # 一楼
        floor.FloorGenerator.floor_1(mp.currentFloor["floor"])

        while mp.currentFloor["floor"].choicesNext(cm):
            # 走到的场景
            scene = mp.currentFloor["floor"].map[
                mp.currentFloor["floor"].pos_step][
                mp.currentFloor["floor"].pos_group]
        # 循环结束代表这一层走完了

        # 结束
        Mainloop.gameover()